<?php
namespace Home\Controller;
use Think\Controller;
use Tools\Page;

import("Common.Common.Tools");
class ArticleController extends Controller {
    function showlist(){
        $article=new \Model\ArticleModel();
        $article_count=$article->count();
        $article_page=getPage($article_count,5);
        $info=$article->order('id desc')->limit($article_page->firstRow.','.$article_page->listRows)->select();

        $i=0;
        while($info["$i"]!==null){
                $info["$i"]['content'] = strip_tags($info["$i"]['content']);
                $i++;
        }

        $this->assign('info',$info);
        $article_show=$article_page->show();
        $this->assign('page',$article_show);
        $diary=M('Diary');
        $diary_info=$diary->order('id desc')->limit(10)->select();
        $this->assign('diary_info',$diary_info);

        $link=M('Link');
        $link_info=$link->select();
        $this->assign('link_info',$link_info);
        $this->display();
    }
    function content($id){
        $content=M('Article');
        $c_info=$content->where("id=$id")->find();
        $info=$content->select();
        $this->assign('info',$info);
        $this->assign('c_info',$c_info);
        $link=M('Link');
        $link_info=$link->select();
        $this->assign('link_info',$link_info);
        $this->display();

    }



}